package com.lagou.service.impl;

import com.lagou.service.MonitorService;
import org.apache.dubbo.config.annotation.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Random;

/**
 * @ClassName MonitorServiceImpl
 * @Description
 * @Author playboy
 * @Date 2021/6/19 10:14 上午
 * @Version 1.0
 **/
@Service
public class MonitorServiceImpl implements MonitorService {
	private static Logger log = LoggerFactory.getLogger(MonitorServiceImpl.class);

	@Override
	public String methodA() {
		Random random = new Random();
		int i = random.nextInt(100);
		System.out.println();
		try {
			Thread.sleep(i);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		log.info("methodA被调用，耗时{}毫秒", i);
		return "" + i;
	}

	@Override
	public String methodB() {
		Random random = new Random();
		int i = random.nextInt(100);
		try {
			Thread.sleep(i);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		log.info("methodB被调用，耗时{}毫秒", i);
		return "" + i;
	}

	@Override
	public String methodC() {
		Random random = new Random();
		int i = random.nextInt(100);
		try {
			Thread.sleep(i);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		log.info("methodC被调用，耗时{}毫秒", i);
		return "" + i;
	}
}
